﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WpfApp.ViewModels;

namespace WpfApp
{
    /// <summary>
    /// Interaction logic for KillOneCodeWindow.xaml
    /// </summary>
    public partial class KillOneCodeWindow : Window
    {
        public KillOneCodeWindow()
        {
            InitializeComponent();
            Closed += new System.EventHandler(KillOneCodeWindow_Closed);
            var vm = new TestViewModel();
            this.DataContext = vm;
            this.LotteryHistoryGird.ItemsSource = vm.LotteryModels;

        }

        private static readonly Object oLock = new object();
        private static KillOneCodeWindow _instance;

        public static KillOneCodeWindow Instance
        {
            get
            {
                if (_instance == null)
                {
                    lock (oLock)
                    {
                        if (_instance == null)
                        {

                            _instance = new KillOneCodeWindow();
                        }
                    }
                }

                return _instance;
            }
        }

        private void KillOneCodeWindow_Closed(object sender, System.EventArgs e)
        {
            _instance = null;
        }
    }
}
